#+TITLE: Msmtp
#+AUTHOR: Joshua Branson


* sending emails via msmtp

You need a basic email.  Here's what that might look like:

#+BEGIN_EXAMPLE
Subject:  Here is the Subject
Date: Tue, 15 Jun 2021 04:21:06 -0600
Message-ID: <12345@local.machine.example>
#+END_EXAMPLE

#+BEGIN_EXAMPLE
To: bransoj@hotmail.com
From: jbranso@dismail.de
Subject:  Here is the Subject

Hello my dear friend,

How are you this fine day?

Thanks,

Joshua
#+END_EXAMPLE

#+BEGIN_SRC shell :results raw
cat ./examples/basic-email.txt
#+END_SRC

#+RESULTS:
To: bransoj@hotmail.com
From: jbranso@dismail.de
Subject:  Here is the Subject

Hello my dear friend,

How are you this fine day?

Thanks,

Joshua

This is NOT how you do it:
#+BEGIN_SRC shell :results raw
cat ./examples/basic-email.txt | msmtp 2>&1
#+END_SRC

#+RESULTS:

Here is how you might use it in reality:
#+BEGIN_SRC shell :results raw
cat ./examples/basic-email.txt | msmtp -- 'bransoj@hotmail.com'
#+END_SRC

#+RESULTS:
To: bransoj@hotmail.com
From: jbranso@dismail.de
Subject:  Here is the Subject

Hello my dear friend,

How are you this fine day?

Thanks,

Joshua
